#include "headfile.h"

void NVIC_IRQ_Init(void)
{
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
	
	NVIC_InitTypeDef NVIC_Struct;
	
	NVIC_Struct.NVIC_IRQChannelCmd = ENABLE;
	NVIC_Struct.NVIC_IRQChannelPreemptionPriority = 0;
	NVIC_Struct.NVIC_IRQChannelSubPriority = 0;
	
	NVIC_Struct.NVIC_IRQChannel = EXTI4_IRQn;
	NVIC_Init(&NVIC_Struct);
	
	NVIC_Struct.NVIC_IRQChannel = EXTI9_5_IRQn;
	NVIC_Init(&NVIC_Struct);
	
	NVIC_Struct.NVIC_IRQChannel = EXTI15_10_IRQn;
	NVIC_Init(&NVIC_Struct);
	
	NVIC_Struct.NVIC_IRQChannelSubPriority = 0;
	NVIC_Struct.NVIC_IRQChannel = TIM6_DAC_IRQn;
	NVIC_Init(&NVIC_Struct);
	
	NVIC_Struct.NVIC_IRQChannelSubPriority = 0;
	NVIC_Struct.NVIC_IRQChannel = TIM7_IRQn;
	NVIC_Init(&NVIC_Struct);
	
	NVIC_Struct.NVIC_IRQChannelPreemptionPriority = 1;
	NVIC_Struct.NVIC_IRQChannelSubPriority = 0;
	NVIC_Struct.NVIC_IRQChannel = USART1_IRQn;
	NVIC_Init(&NVIC_Struct);
	
	NVIC_Struct.NVIC_IRQChannelPreemptionPriority = 1;
	NVIC_Struct.NVIC_IRQChannelSubPriority = 0;
	NVIC_Struct.NVIC_IRQChannel = USART2_IRQn;
	NVIC_Init(&NVIC_Struct);
}
